using UnityEngine;
using UnityEngine.UI;

public class PlayerItemUI : MonoBehaviour
{
    [SerializeField] private Text playerNameText;    // 玩家名称文本
    [SerializeField] private Image hostIcon;         // 房主图标
    [SerializeField] private Image readyIcon;        // 准备就绪图标
    
    // 设置玩家信息
    public void SetPlayerInfo(PlayerInfo info)
    {
        if (info == null) return;
        
        // 更新玩家名称
        if (playerNameText != null)
            playerNameText.text = info.playerName;
        
        // 更新房主图标
        if (hostIcon != null)
            hostIcon.gameObject.SetActive(info.isHost);
        
        // 更新准备就绪图标
        if (readyIcon != null)
            readyIcon.gameObject.SetActive(info.isReady);
    }
}